package com.huangj.pro2_h2pop;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.widget.ImageView;

import com.huangj.huangjlibrary.base.BaseActivity;
import com.huangj.huangjlibrary.util.SharedUtil;

import butterknife.BindView;

public class WeclomeActivity extends BaseActivity {

    @BindView(R.id.iv_weclome)
    public ImageView iv_weclome;

    @Override
    protected int getContentId() {
        return R.layout.weclome_layout;
    }

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
    }

    @Override
    protected void init() {
        //表示该程序程序专用；
        //SharedPreferences sharedPreferences = this.getSharedPreferences("share", MODE_PRIVATE);
        //取值 ；  没有值则默认返回true;
        //SharedPreferences.Editor editor = sharedPreferences.edit();

        boolean isFirstRun = SharedUtil.getBoolean("isFirstRun");
        if (isFirstRun) {//表示第一次进入程序；
            SharedUtil.putBoolean("isFirstRun", false);
            starActivityForAnimation(new Intent(WeclomeActivity.this,FirstMediaActivity.class)
            ,R.anim.bottom_in
            ,R.anim.bottomout);
            finish();
        } else {
            iv_weclome.postDelayed(new Runnable() {
            //显示跳转;
            @Override
            public void run() {
                starActivityForAnimation(new Intent(WeclomeActivity.this, MainActivity.class),
                        R.anim.anim_show,
                        R.anim.anim_dismiss);
                finish();
                }
            },2000);
        }

    }
}
